package com.situ.javase.week2.Day5;

public class ThreadDemo {
	
	public static void main1(String[] args) {
		//System.out.println(Thread.currentThread().getName());
		
		//MyThread myThread = new MyThread();
		//这不是启动一个线程，这是调用对象里面一个普通方法run方法
		//myThread.run();
		//真正启动一个线程调用start()方法，执行的代码就是run方法里面的代码
		//myThread.start();
	}
	
	public static void main(String[] args) {
		MyRunnable myRunnable = new MyRunnable();
		Thread thread1 = new Thread(myRunnable,"偶数线程");
		thread1.start();
		
		
		JishuRunable jishuRunable = new JishuRunable();
		Thread thread2 = new Thread(jishuRunable,"奇数线程");
		thread2.start();
	}
	
	public static void main2(String[] args) {
		 MyRunnable myRunnable = new MyRunnable();
		 Thread thread = new Thread(myRunnable);
		 thread.start();
	
		 
		 String name = Thread.currentThread().getName();
		  for (int i = 0; i < 100; i++) {
		    System.out.println(name + " ：" + i);
	}
	
}
}
